package com.bwie.goods.controller;

import com.bwie.common.domain.Collect;
import com.bwie.common.result.Result;
import com.bwie.goods.service.CollectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/Collect")
public class CollectController {
    @Autowired
    CollectService collectService;

    /**
     * 收藏列表
     * @return
     */
    @PostMapping("/list")
    public Result<List<Collect>> list(){
        Result<List<Collect>> list=collectService.list();
        return list;
    }

    /**
     * 添加收藏
     * @param id
     * @return
     */
    @PostMapping("/collectAdd")
    public Result collectAdd(@RequestParam Integer id){
        Result collect=collectService.collectAdd(id);
        return collect;
    }

    /**
     * 取消收藏
     * @param id
     * @return
     */
    @DeleteMapping("/delete")
    public Result delete(@RequestParam Integer id){
        Result result=collectService.delete(id);
        return result;
    }
}
